<!DOCTYPE html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="author" content="Mattia Larentis">
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8;">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link href="/static/CSS/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/CSS/bootstrap-switch.min.css">
</head>
<body>
    <input type="checkbox" data-color="warning" name="my-checkbox" checked />
    <input type="checkbox" data-off-color="warning" name="my-checkbox" checked />
    <input type="checkbox"  data-on-color="warning" name="my-checkbox" checked />
    <input type="checkbox" data-on-color="danger" name="my-checkbox" checked />
    <input type="checkbox" data-on-color="primary" name="my-checkbox" checked />
    <input id="switch-offColor" type="checkbox" name="my-checkbox"  data-off-color="danger">
    <input type="checkbox" name="my-checkbox" data-on-label="开" data-off-label="关"  checked />
    <br />
    <input id="switch-state" type="checkbox" checked data-on-text="开" data-off-text="关">
     <button type="button" data-switch-get="state" class="btn btn-default">Get</button>
     <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
     <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
     <script type="text/javascript" src="/static/JS/bootstrap-switch.min.js"></script>
    <script>
        $(function () {
            $("input[type=\"checkbox\"], input[type=\"radio\"]").not("[data-switch-no-init]").bootstrapSwitch();
            $("[name='my-checkbox']").bootstrapSwitch();
            $("[data-switch-get]").on("click", function () {
                var type;
                type = $(this).data("switch-get");
                alert($("#switch-state").bootstrapSwitch("state"));
                return alert($("#switch-" + type).bootstrapSwitch(type));
            });


        })
    </script>
</body>
</html>

